package com.apes.fn.fico.reimbursement.repository;

import com.apes.fn.fico.reimbursement.model.ExpenseDebitItem;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by lishikun on 2021/2/24 17:44
 */
public interface ExpenseDebitItemRepository extends CustomRepository<ExpenseDebitItem, String> {
    @Query("select T from ExpenseDebitItem T,ExpenseDebit Y where T.dutyCenter.id=?1 and T.expenseDebit.id = Y.id and Y.state = 'repayment' and T.expenseAmount>(T.repaymentAmount+T.freezeAmount) ")
    List<ExpenseDebitItem> findAllByDutyCenter(String dutyCenterId);
}
